gg.path('demo');

var tetris = window.tetris = gg.object({
    classType: 'game.Tetris'
});
tetris.start(7);
tetris.on('onElimate', function(obj, rows){
    console.log('elimate', rows);
});

$('body').bind('keydown', function(e){
    var key = e.keyCode;
    if(key === 37){
        tetris.handleLeft();
    }else if(key === 39){
        tetris.handleRight();
    }else if(key === 40){
        tetris.handleDown();
    }else if(key === 38){
        tetris.handleRotateCW();
    }else if(key === 32){
        tetris.fallT();
    }
})
//tetris.moveT(5,10);
/*
 var logic = gg.object({classType:'Manager'});
 var ui = gg.object({classType:'Manager'});
 var project = gg.module('project');
 var app = window.app = gg.object(project);
 
 var ide = window.ide = gg.object(gg.module('editor.data.ide'));
 
 $('body').append(ide.el);
 
 var selected = null;
 function select(obj) {
 if (selected) {
 selected.css('outline', 'none');
 }
 obj.css('outline', '1px dashed red');
 selected = obj;
 }
 $('body').delegate('.ui', 'mouseenter', function() {
 select($(this));
 }).delegate('.ui', 'mouseleave', function() {
 select($(this).parent('.ui'));
 });
 
 */